package admin.common;

import lombok.Data;

/**
 * @author xf07b1
 * @wechat xf07b1
 * @description 统一结果集
 */
@Data
public class Result {

    private Integer code;

    private String message;

    private Object data;

    private Result() {
    }

    public static Result ok() {
        Result result = new Result();
        result.setCode(200);
        result.setMessage("ok");
        return result;
    }

    public static Result error() {
        Result result = new Result();
        result.setCode(400);
        result.setMessage("error");
        return result;
    }

    public Result data(Object data) {
        this.setData(data);
        return this;
    }

    public Result message(String msg) {
        this.setMessage(msg);
        return this;
    }

    public Result code(Integer code) {
        this.setCode(code);
        return this;
    }
}

